<?php
namespace app\admin\controller;
use app\admin\model\Good_order;

/**
 * 订单管理
 * Class Member
 */
class OrderController extends BaseController {

    protected function _initialize() {
        parent::_initialize();
    }

    /**
     * 用户管理
     * @param string $keyword
     * @param int    $page
     * @return mixed
     */
    public function index($keyword = '', $ziduan = 'id', $param='add_time', $sort='desc') {
        $map = [];
		$order = $param. ' '.$sort;
		$this->assign('param', $param);
		$this->assign('sort', $sort);
        if ($keyword) {
            $map[$ziduan] = $keyword;
        }
		$this->assign('ziduan', $ziduan);
        $order_list = db('good_order')->where($map)->order($order)->paginate(15, false, get_query());
        return $this->fetch('index', ['order_list' => $order_list, 'keyword' => $keyword]);
    }

    /**
     * 订单详情
     * @param $id
     * @return mixed
     */
    public function info($id) {
    	$order_model = new Good_order();
        $order = $order_model->where('order_id',$id)->find();
        return $this->fetch('info', ['order' => $order]);
    }
	
	//删除会员
	public function delete_item(){
		$res = db('good_order')->where('order_id',input("id"))->delete();
		if($res){
			 $this->success('删除成功',url("index"));
		}else{
			 $this->success('删除失败');
		}
	}

}
